package com;

import com.h2cloud.Proxy.MyController;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.Configuration;

@SpringBootApplication
@Configuration
public class MyspringbootApplication {

//
//    // 继承SpringBootServletInitializer 实现configure 方便打war 外部服务器部署。
//    @Override
//    protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
//        return application.sources(MyspringbootApplication.class);
//    }


    public static void main(String[] args) throws Exception {
        ConfigurableApplicationContext applicationContext = SpringApplication.run(MyspringbootApplication.class, args);
//        TestService6 testService6 = applicationContext.getBean("testService6", TestService6.class);
//        System.out.println("testService6 = " + testService6);
//        System.out.println("AopUtils.isCglibProxy(testService6) = " + AopUtils.isCglibProxy(testService6));
//        TestService2 testService21 = testService6.getTestService2();
//        System.out.println("testService6.getTestService2() = " + testService21);
//        System.out.println("AopUtils.isCglibProxy(testService6.getTestService2()) = " + AopUtils.isCglibProxy(testService21));
//        Object target = AopTargetUtils.getTarget(testService21);
//        System.out.println("target = " + target);
//
//
//        TestService2 testService2 = applicationContext.getBean("testService2", TestService2.class);
//        System.out.println("testService2 = " + testService2);
//        System.out.println("AopUtils.isCglibProxy(testService2) = " + AopUtils.isCglibProxy(testService2));
//        System.out.println("testService2.getTestService1() = " + testService2.getTestService1());
//        System.out.println("AopUtils.isCglibProxy(testService2.getTestService1()) = " + AopUtils.isCglibProxy(testService2.getTestService1()));
//
//        System.out.println("target == testService2 : " + (target == testService2));

        MyController bean = applicationContext.getBean(MyController.class);
        bean.get();
    }
}
